﻿@laamp_gallivanter_ai_will_do_bonus_1_value = 10
@laamp_gallivanter_ai_will_do_bonus_2_value = 30
@laamp_gallivanter_ai_will_do_bonus_3_value = 50

@laamp_gallivanter_ai_will_do_malus_1_value = -10
@laamp_gallivanter_ai_will_do_malus_2_value = -30
@laamp_gallivanter_ai_will_do_malus_3_value = -50


#############################################
# Abandom Realm to Become an Adventurer		#
# by Joe Parkin								#
#############################################

become_landless_adventurer_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/ep3_decision_laamp_neutral_mountain.dds"
	}
	sort_order = 82
	ai_check_interval = 120

	desc = become_landless_adventurer_decision_desc
	selection_tooltip = become_landless_adventurer_decision_tooltip

	is_shown = {
		#DLC check.
		has_ep3_dlc_trigger = yes
		OR = {
			ai_can_valid_to_create_laamp_trigger = yes
			is_ai = no
		}
		#Standard filter checks.
		is_landed = yes
		# Relevant cultures/faiths
		OR = {
			culture = { has_cultural_parameter = unlock_voluntary_laampdom }
			faith = { has_doctrine_parameter = unlock_voluntary_laampdom_faith }
			has_trait = nomadic_philosophy
		}
		save_temporary_scope_as = potential_laamp_temp
		can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:potential_laamp_temp } # Registered fighting license
	}

	is_valid = {
		is_valid_for_laampdom = yes
		# Is not HOF
		custom_tooltip = {
			text = become_landless_adventurer_decision_hof_tt
			NOT = { faith.religious_head_title.holder = root }
		}
		# Counts and dukes only
		custom_tooltip = {
			text = become_landless_adventurer_decision_tier_tt
			highest_held_title_tier >= tier_county
			highest_held_title_tier <= tier_duchy
		}
		# Not too big
		custom_tooltip = {
			text = become_landless_adventurer_decision_domain_size_tt
			domain_size <= 3
		}
		# Relevant cultures/faiths
		OR = {
			culture = { has_cultural_parameter = unlock_voluntary_laampdom }
			faith = { has_doctrine_parameter = unlock_voluntary_laampdom_faith }
			has_trait = nomadic_philosophy
			custom_tooltip = {
				text = nomadic_government_tt
				government_has_flag = government_is_nomadic
			}
			
		}
	}

	is_valid_showing_failures_only = {
		is_at_war = no
		is_alive = yes
		is_available_adult = yes
		has_contagious_deadly_disease_trigger = no
	}

	effect = {
		save_scope_as = adventurer
		if = {
			limit = {
				player_heir ?= {
					NOT = { this = root }
					is_adult = yes
				}
			}
			player_heir = {
				save_scope_as = laamp_heir
				save_scope_as = laamp_inheritor
				custom_tooltip = become_landless_adventurer_decision_title_scope_tt
			}
		}
		else_if = {
			limit = { is_independent_ruler = no }
			liege = {
				save_scope_as = laamp_liege
				save_scope_as = laamp_inheritor
				custom_tooltip = become_landless_adventurer_decision_title_scope_tt
			}
		}
		else = {
			custom_tooltip = become_landless_adventurer_decision_title_created_tt
			if = {
				limit = {
					NOT = { exists = scope:laamp_inheritor }
				}
				hidden_effect_new_object = {
					create_character = {
						template = laamp_inheritor_template
						culture = root.capital_county.culture
						faith = root.capital_county.faith
						dynasty = generate
						location = root.capital_province
						after_creation = {
							save_scope_as = laamp_inheritor
							add_character_flag = new_laamp_inheritor
						}
					}
				}
			}
		}
		create_landless_adventurer_title_tooltip_effect = yes
		show_as_tooltip = {
			add_prestige = medium_prestige_gain
			add_character_modifier = {
				modifier = ep3_voluntary_laamp_character_modifier
				years = 5
			}
		}
		trigger_event = { id = ep3_laamps.0030 }
		# Debug tracking
		if = {
			limit = {
				is_ai = yes
				debug_only = yes
			}
			if = {
				limit = { exists = global_var:ai_voluntary_laamp_count }
				change_global_variable = {
					name = ai_voluntary_laamp_count
					add = 1
				}
			}
			else = {
				set_global_variable = {
					name = ai_voluntary_laamp_count
					value = 1
				}
			}
			debug_log = "AI became adventurer voluntarily"
			debug_log_scopes = yes
		}
		stress_impact = {
			craven = minor_stress_impact_gain
			content = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
		}
	}

	ai_potential = {
		is_valid_for_laampdom = yes
		trigger_if = { # Temujun stays, he needs to become Genghis Khan after all!
			limit = {
				exists = character:125501
			}
			NOT = { this = character:125501 }
		}
	}

	ai_will_do = {
		base = -75
		modifier = { add = ep3_laamp_chance_score_value }
		modifier = { # If we don't have this, everyone will leave your realm constantly
			add = -45
			culture = { has_cultural_parameter = much_more_likely_to_be_laamps }
		}
		modifier = { # If we don't have this, everyone will leave your realm constantly
			add = -20
			culture = { has_cultural_parameter = more_likely_to_be_laamps }
		}
		modifier = {
			factor = 0
			OR = {
				#Stahp it, John de Courcy
				this = character:214000
				#No adventurer should want to be one again... right?
				has_variable = adventurer_creation_reason
			}
		}
	}
}

#############################################
# Wipe Slate								#
# by Joe Parkin & Ewan Cowhig Croft			#
#############################################

wipe_slate_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_recruitment.dds" }
	desc = wipe_slate_decision_desc
	selection_tooltip = wipe_slate_decision_tooltip
	ai_check_interval = 36
	decision_group_type = adventurer_minor

	cooldown = { years = 1 }

	is_shown = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Plus, we must have the actual trait.
		has_trait = gallowsbait
	}

	cost = {
		gold = {
			value = 100
			add = {
				value = highest_held_title_tier
				multiply = 25
			}
		}
		prestige = {
			add = {
				value = highest_held_title_tier
				multiply = 25
			}
		}
		piety = {
			add = {
				value = highest_held_title_tier
				multiply = 50
			}
		}
	}

	is_valid_showing_failures_only = {
		# Standard filter checks.
		is_available_adult = yes
	}

	widget = {
		gui = "decision_view_widget_option_list_generic"
		controller = decision_option_list_controller
		decision_to_second_step_button = "WIPE_SLATE_DECISION_NEXT_STEP_BUTTON"
		item = {
			value = track_bandit
			is_valid = {
				has_trait_xp = {
					trait = gallowsbait
					track = bandit
					value >= wipe_slate_min_xp_to_remove_trait_value
				}
			}
			localization = wipe_slate_decision_option_bandit
			icon = "gfx/interface/icons/trait_level_tracks/bandit.dds"
		}
		item = {
			value = track_trickster
			is_valid = {
				has_trait_xp = {
					trait = gallowsbait
					track = trickster
					value >= wipe_slate_min_xp_to_remove_trait_value
				}
			}
			localization = wipe_slate_decision_option_trickster
			icon = "gfx/interface/icons/trait_level_tracks/trickster.dds"
		}
		item = {
			value = track_thief
			is_valid = {
				has_trait_xp = {
					trait = gallowsbait
					track = thief
					value >= wipe_slate_min_xp_to_remove_trait_value
				}
			}
			localization = wipe_slate_decision_option_thief
			icon = "gfx/interface/icons/trait_level_tracks/thief.dds"
		}
		item = {
			value = track_poacher
			is_valid = {
				has_trait_xp = {
					trait = gallowsbait
					track = poacher
					value >= wipe_slate_min_xp_to_remove_trait_value
				}
			}
			localization = wipe_slate_decision_option_poacher
			icon = "gfx/interface/icons/trait_level_tracks/poacher.dds"
		}
		item = {
			value = track_marauder
			is_valid = {
				has_trait_xp = {
					trait = gallowsbait
					track = marauder
					value >= wipe_slate_min_xp_to_remove_trait_value
				}
			}
			localization = wipe_slate_decision_option_marauder
			icon = "gfx/interface/icons/trait_level_tracks/marauder.dds"
		}
		item = {
			value = trait_gallowsbait
			is_valid = {
				custom_tooltip = {
					text = wipe_slate_decision_option_gallowsbait.tt.must_have_below_max_in_all_values
					has_trait_xp = {
						trait = gallowsbait
						track = bandit
						value < wipe_slate_min_xp_to_remove_trait_value
					}
					has_trait_xp = {
						trait = gallowsbait
						track = trickster
						value < wipe_slate_min_xp_to_remove_trait_value
					}
					has_trait_xp = {
						trait = gallowsbait
						track = thief
						value < wipe_slate_min_xp_to_remove_trait_value
					}
					has_trait_xp = {
						trait = gallowsbait
						track = poacher
						value < wipe_slate_min_xp_to_remove_trait_value
					}
					has_trait_xp = {
						trait = gallowsbait
						track = marauder
						value < wipe_slate_min_xp_to_remove_trait_value
					}
				}
			}
			localization = wipe_slate_decision_option_gallowsbait
			icon = "gfx/interface/icons/traits/gallowsbait.dds"
		}
	}

	effect = {
		save_scope_value_as = {
			name = scrubbable
			value = {
				value = -35
				if = {
					limit = {
						domicile ?= { has_domicile_parameter = camp_improves_wipe_slate_decision }
					}
					add = -35
				}
			}
		}
		show_as_tooltip = {
			random_list = {
				100 = {
					show_chance = no
					desc = wipe_slate_decision.tt.remove_bandit
					send_interface_toast = {
						title = wipe_slate_decision.tt.slate_wiped
						add_trait_xp = {
							trait = gallowsbait
							track = bandit
							value = scope:scrubbable
						}
					}
				}
				100 = {
					show_chance = no
					desc = wipe_slate_decision.tt.remove_trickster
					send_interface_toast = {
						title = wipe_slate_decision.tt.slate_wiped
						add_trait_xp = {
							trait = gallowsbait
							track = trickster
							value = scope:scrubbable
						}
					}
				}
				100 = {
					show_chance = no
					desc = wipe_slate_decision.tt.remove_thief
					send_interface_toast = {
						title = wipe_slate_decision.tt.slate_wiped
						add_trait_xp = {
							trait = gallowsbait
							track = thief
							value = scope:scrubbable
						}
					}
				}
				100 = {
					show_chance = no
					desc = wipe_slate_decision.tt.remove_poacher
					send_interface_toast = {
						title = wipe_slate_decision.tt.slate_wiped
						add_trait_xp = {
							trait = gallowsbait
							track = poacher
							value = scope:scrubbable
						}
					}
				}
				100 = {
					show_chance = no
					desc = wipe_slate_decision.tt.remove_marauder
					send_interface_toast = {
						title = wipe_slate_decision.tt.slate_wiped
						add_trait_xp = {
							trait = gallowsbait
							track = marauder
							value = scope:scrubbable
						}
					}
				}
				100 = {
					show_chance = no
					desc = wipe_slate_decision.tt.remove_gallowsbait
					send_interface_toast = {
						title = wipe_slate_decision.tt.slate_wiped
						remove_trait = gallowsbait
					}
				}
			}
		}
		hidden_effect = {
			switch = {
				trigger = yes
				scope:track_bandit = {
					add_trait_xp = {
						trait = gallowsbait
						track = bandit
						value = scope:scrubbable
					}
				}
				scope:track_trickster = {
					add_trait_xp = {
						trait = gallowsbait
						track = trickster
						value = scope:scrubbable
					}
				}
				scope:track_thief = {
					add_trait_xp = {
						trait = gallowsbait
						track = thief
						value = scope:scrubbable
					}
				}
				scope:track_poacher = {
					add_trait_xp = {
						trait = gallowsbait
						track = poacher
						value = scope:scrubbable
					}
				}
				scope:track_marauder = {
					add_trait_xp = {
						trait = gallowsbait
						track = marauder
						value = scope:scrubbable
					}
				}
				scope:trait_gallowsbait = { remove_trait = gallowsbait }
			}
		}
	}
	
	ai_potential = {
		government_has_flag = government_is_landless_adventurer
		ai_honor > 0
		ai_compassion >= -25
		ai_rationality >= 0
		gold >= 500
	}

	ai_will_do = {
		base = 100
	}
}

#############################################
# Adopt kennel dog							#
# by James Beaumont							#
#############################################

adopt_a_kennel_dog = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_pet_dog.dds" }
	desc = adopt_a_kennel_dog_desc
	selection_tooltip = adopt_a_kennel_dog_tooltip
	ai_check_interval = 36
	decision_group_type = adventurer_minor

	cooldown = { years = 5 }
	is_shown = {
		#DLC check.
		has_ep3_dlc_trigger = yes
		#Standard filter checks.
		domicile ?= { has_domicile_parameter = camp_unlocks_adopt_a_kennel_dog_decision }
		NOT = {
			any_owned_story = {
				story_type = story_cycle_pet_dog
			}
		}
	}

	is_valid_showing_failures_only = {
		is_alive = yes
		is_available_adult = yes
		has_contagious_deadly_disease_trigger = no
	}

	effect = {
		show_as_tooltip = { start_dog_story_cycle_effect = yes }
		trigger_event = ep3_laamps.8010
	}

	ai_potential = {
		government_has_flag = government_is_landless_adventurer
		# Has enough gold.
		short_term_gold >= minor_gold_value
		NOR = {
			has_trait = lazy
			has_trait = callous
		}
	}

	ai_will_do = {
		base = 100
		# You're richer.
		modifier = {
			add = 50
			faith = { has_doctrine_parameter = gruesome_festivals_active }
			short_term_gold >= massive_gold_value
		}
		modifier = {
			add = 50
			faith = { has_doctrine_parameter = gruesome_festivals_active }
			short_term_gold >= monumental_gold_value
		}
		ai_value_modifier = {
			ai_compassion = 1.5
			ai_rationality = 1
		}
	}
}

#############################################
# Treasure Hunting Contract					#
# by Arkadiusz Majewski						#
#############################################
treasure_hunting_contract_decision = {
	picture = { reference = "gfx/interface/illustrations/army_status/moving.dds" }
	desc = treasure_hunting_contract_decision_desc
	selection_tooltip = treasure_hunting_contract_decision_tooltip
	ai_check_interval = 36
	decision_group_type = adventurer_minor

	#cooldown = { years = 5 }

	is_shown = {
		#DLC check.
		has_ep3_dlc_trigger = yes

		any_character_active_contract = {
			has_task_contract_type = laamp_treasure_hunting_contract
		}
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
		has_contagious_deadly_disease_trigger = no
		is_travelling = no
	}

	is_valid = {
		any_character_active_contract = {
			has_task_contract_type = laamp_treasure_hunting_contract
		}
	}
	widget = {
		gui = "decision_view_widget_option_list_generic"
		controller = decision_option_list_controller
		decision_to_second_step_button = "TREASURE_HUNTING_CONTRACT_DECISION_NEXT_STEP_BUTTON"
		#cover world regions, have to be the same as in get_adventure_inspiration_start_location 
		item = {
			value = search_europe_north
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_europe
							geographical_region = world_steppe_west
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_europe_north
			icon = "gfx/interface/icons/terrain_types/taiga.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_europe_west
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_europe
							geographical_region = world_africa_north
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_europe_west
			icon = "gfx/interface/icons/terrain_types/plains.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_europe_east
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_europe
							geographical_region = world_steppe_west
							geographical_region = world_asia_minor		
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_europe_east
			icon = "gfx/interface/icons/terrain_types/forest.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_europe_south
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_europe
							geographical_region = world_steppe_west
							geographical_region = world_asia_minor
							geographical_region = world_africa_north
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_europe_south
			icon = "gfx/interface/icons/terrain_types/coastal_sea.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_africa_north
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_europe_south
							geographical_region = world_europe_west
							geographical_region = world_asia_minor
							geographical_region = world_middle_east_jerusalem
							geographical_region = world_africa
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_africa_north
			icon = "gfx/interface/icons/terrain_types/drylands.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_africa_west
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_europe_south
							geographical_region = world_africa
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_africa_west
			icon = "gfx/interface/icons/terrain_types/jungle.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_africa_east
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_europe_south
							geographical_region = world_asia_minor
							geographical_region = world_middle_east_jerusalem
							geographical_region = world_middle_east_arabia
							geographical_region = world_africa
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_africa_east
			icon = "gfx/interface/icons/terrain_types/hills.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_middle_east_jerusalem
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_europe_south
							geographical_region = world_asia_minor
							geographical_region = world_middle_east
							geographical_region = world_africa_north
							geographical_region = world_africa_east
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_middle_east_jerusalem
			icon = "gfx/interface/icons/terrain_types/drylands.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_asia_minor
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_europe_south
							geographical_region = world_middle_east
							geographical_region = world_africa_north
							geographical_region = world_africa_east
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_asia_minor
			icon = "gfx/interface/icons/terrain_types/hills.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_middle_east_arabia
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_europe_south
							geographical_region = world_middle_east
							geographical_region = world_africa_north
							geographical_region = world_africa_east
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_middle_east_arabia
			icon = "gfx/interface/icons/terrain_types/desert.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_middle_east_persia
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_europe_south
							geographical_region = world_middle_east
							geographical_region = world_africa_north
							geographical_region = world_africa_east
							geographical_region = world_india_rajastan
							geographical_region = world_steppe_west
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_middle_east_persia
			icon = "gfx/interface/icons/terrain_types/desert_mountains.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_india_rajastan
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_middle_east
							geographical_region = world_india
							geographical_region = world_steppe_west
							geographical_region = world_burma
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_india_rajastan
			icon = "gfx/interface/icons/terrain_types/desert.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_india_deccan
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_middle_east
							geographical_region = world_india
							geographical_region = world_steppe_west
							geographical_region = world_burma
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_india_deccan
			icon = "gfx/interface/icons/terrain_types/drylands.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_india_bengal
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_middle_east
							geographical_region = world_india
							geographical_region = world_steppe_west
							geographical_region = world_burma
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_india_bengal
			icon = "gfx/interface/icons/terrain_types/jungle.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_burma
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_india
							geographical_region = world_tibet
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_burma
			icon = "gfx/interface/icons/terrain_types/floodplains.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_tibet
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_india
							geographical_region = world_steppe
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_tibet
			icon = "gfx/interface/icons/terrain_types/mountains.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_steppe_tarim
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_india
							geographical_region = world_tibet
							geographical_region = world_steppe
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_steppe_tarim
			icon = "gfx/interface/icons/terrain_types/desert.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_steppe_west
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_india
							geographical_region = world_tibet
							geographical_region = world_steppe
							geographical_region = world_europe_east
							geographical_region = world_europe_north
							geographical_region = world_asia_minor
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_steppe_west
			icon = "gfx/interface/icons/terrain_types/steppe.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = search_steppe_east
			is_valid = {
				custom_description = {
					text = treasure_hunting_contract_decision_limit
					capital_province = {
						OR = {
							geographical_region = world_india
							geographical_region = world_tibet
							geographical_region = world_steppe
						}
					}
				}
			}
			localization = treasure_hunting_contract_decision_option_search_steppe_east
			icon = "gfx/interface/icons/terrain_types/mountains.dds"
			ai_chance = {
				value = 50
			}
		}
	}

	effect = {
		switch = {
			trigger = yes
			scope:search_africa_north = {
				set_variable = {
					name = adventure_destination
					value = flag:africa_north
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_africa_west = {
				set_variable = {
					name = adventure_destination
					value = flag:africa_west
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_africa_east = {
				set_variable = {
					name = adventure_destination
					value = flag:africa_east
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_europe_north = {
				set_variable = {
					name = adventure_destination
					value = flag:europe_north
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_europe_west = {
				set_variable = {
					name = adventure_destination
					value = flag:europe_west
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_europe_east = {
				set_variable = {
					name = adventure_destination
					value = flag:europe_east
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_europe_south = {
				set_variable = {
					name = adventure_destination
					value = flag:europe_south
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_middle_east_jerusalem = {
				set_variable = {
					name = adventure_destination
					value = flag:middle_east_jerusalem
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_middle_east_arabia = {
				set_variable = {
					name = adventure_destination
					value = flag:middle_east_arabia
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_middle_east_persia = {
				set_variable = {
					name = adventure_destination
					value = flag:middle_east_persia
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_india_deccan = {
				set_variable = {
					name = adventure_destination
					value = flag:india_deccan
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_india_bengal = {
				set_variable = {
					name = adventure_destination
					value = flag:india_bengal
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_india_rajastan = {
				set_variable = {
					name = adventure_destination
					value = flag:india_rajastan
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_steppe_west = {
				set_variable = {
					name = adventure_destination
					value = flag:steppe_west
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_steppe_east = {
				set_variable = {
					name = adventure_destination
					value = flag:steppe_east
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_steppe_tarim = {
				set_variable = {
					name = adventure_destination
					value = flag:steppe_tarim
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_asia_minor = {
				set_variable = {
					name = adventure_destination
					value = flag:asia_minor
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_burma = {
				set_variable = {
					name = adventure_destination
					value = flag:burma
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
			scope:search_tibet = {
				set_variable = {
					name = adventure_destination
					value = flag:tibet
				}
				get_adventure_inspiration_start_location = {
					ADVENTURER = root
				}
			}
		}
		random_character_task_contract = {
			limit = {
				has_task_contract_type = laamp_treasure_hunting_contract
			}
			save_scope_as = task_contract
		}
		scope:location.county = {
			random_county_province = {
				save_scope_as = task_contract_destination
			}
		}
		scope:task_contract = {
			set_variable = {
				name = task_contract_destination
				value = scope:task_contract_destination
			}
		}
		start_travel_plan = {
			destination = scope:task_contract_destination
			on_arrival_event = ep3_contract_event.0006
		}
		custom_tooltip = treasure_hunting_contract_decision_effect
	}

	ai_potential = {
		government_has_flag = government_is_landless_adventurer
	}

	ai_will_do = {
		base = 100
	}
}

#############################################
# Visit Local Settlement					#
#############################################

visit_local_settlement_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_destiny_goal.dds" }
	desc = visit_local_settlement_decision_desc
	selection_tooltip = visit_local_settlement_decision_tooltip
	sort_order = 200
	decision_group_type = adventurer_minor

	#The cooldown is set separately, if you only entered and left you shouldn't get punished for it

	is_shown = {
		#DLC check.
		has_ep3_dlc_trigger = yes
		is_landless_adventurer = yes
	}

	is_valid_showing_failures_only = {
		is_alive = yes
		is_available_adult = yes
		has_contagious_deadly_disease_trigger = no
		root.location = {
			has_holding = yes
			is_occupied = no
			is_raided = no	
		}
		custom_description = {
			text = "visit_local_settlement_decision_sieged"
			subject = root
			root.location = {
				NOT = {
					any_army_in_location = {
						is_army_in_siege = yes
					}
				}
			}
		}
		custom_description = {
			text = "decision_already_visiting_local_settlement"
			subject = root
			NOT = { has_variable = ep3_laamp_decision_1000_is_visiting }
		}
	}
	
	effect = {
		if = {
			limit = {
				root.location = {
					OR = {
						has_holding = no
						has_holding_type = tribal_holding
						has_holding_type = nomad_holding
						has_holding_type = herder_holding
					} 
				}
			}
			#The base tooltip
			custom_tooltip = visit_local_settlement_tribal_holding_decision_tt
		}
		else_if = {
			limit = {
				root.location = { has_holding_type = church_holding }
			}
			#Add on church holding-specific effects
			custom_tooltip = visit_local_settlement_church_holding_decision_tt
		}
		else_if = {
			limit = {
				root.location = { has_holding_type = castle_holding }
			}
			#Add on castle holding-specific effects
			custom_tooltip = visit_local_settlement_castle_holding_decision_tt
		}
		else_if = {
			limit = {
				root.location = { has_holding_type = city_holding }
			}
			#Add on castle holding-specific effects
			custom_tooltip = visit_local_settlement_city_holding_decision_tt
		}
		#To prevent the character, for whatever reason, managing to not have the variable be removed when exiting VS
		temporarily_lock_visit_settlement_effect = yes
		trigger_event = ep3_laamp_decision_event.1000
		close_view = {
			view = decisions
			player = root
		}
	}
	
	ai_check_interval = 12

	ai_potential = {
		government_has_flag = government_is_landless_adventurer
		is_available = yes
	}
	
	ai_will_do = {
		base = 100
	}
}

#############################################
# Visit Local Settlement - Use Treasure Map	#
#############################################

treasure_map_contract_decision = {
	picture = { reference = "gfx/interface/illustrations/army_status/moving.dds" }
	desc = treasure_map_contract_decision_desc
	selection_tooltip = treasure_map_contract_decision_tooltip
	ai_check_interval = 36
	decision_group_type = adventurer_minor

	is_shown = {
		#DLC check.
		has_ep3_dlc_trigger = yes
		any_character_active_contract = { has_task_contract_type = laamp_treasure_map_contract }
		any_character_artifact = { has_variable = 1025_treasure_map }
	}

	is_valid_showing_failures_only = { 
		is_available_allow_travelling = yes
		custom_description = {
			text = "decision_already_excavating_treasure"
			subject = root
			NOR = { 
				has_variable = ep3_laamp_decision_1000_is_planning_excavation_trip
				has_variable = ep3_laamp_decision_1000_is_excavating 
			}
		}
	}

	is_valid = {
		any_character_task_contract = { has_task_contract_type = laamp_treasure_map_contract }
	}

	widget = {
		gui = "decision_view_widget_option_list_generic"
		controller = decision_option_list_controller
		decision_to_second_step_button = "TREASURE_MAP_CONTRACT_DECISION_NEXT_STEP_BUTTON"
		item = {
			value = travel_with_camp
			localization = option_travel_with_camp
			icon = "gfx/interface/icons/travel/icon_travel_hud_placeholder.dds"
			ai_chance = {
				value = 50
			}
		}
		item = {
			value = travel_without_camp
			localization = option_travel_without_camp
			icon = "gfx/interface/icons/trait_level_tracks/travel.dds"
			ai_chance = {
				value = 50
			}
		}
	}

	effect = {
		random_character_task_contract = {
			limit = { has_variable = contract_treasure_location }
			save_scope_as = task_contract
		}
		switch = {
			trigger = yes
			scope:travel_with_camp = {
				start_travel_plan = {
					destination = scope:task_contract.var:contract_treasure_location
					travel_with_domicile = yes
					return_trip = no
					on_arrival_event = ep3_contract_event.0044
					on_arrival_destinations = last
				}
			}
			scope:travel_without_camp = {
				start_travel_plan = {
					destination = scope:task_contract.var:contract_treasure_location
					on_arrival_event = ep3_contract_event.0044
				}
			}
		}
		custom_tooltip = treasure_map_contract_decision_effect_tooltip
		#Make sure to remove this variable upon completion, invalidation, cancelling travel plan etc
		set_variable = ep3_laamp_decision_1000_is_planning_excavation_trip
		#To remove the variable for those who go into the travel planner but then decide not to travel to the Excavation Site
		trigger_event = {
			id = ep3_contract_event.0055
			days = 1
		}
	}

	ai_potential = {
		government_has_flag = government_is_landless_adventurer
	}

	ai_will_do = {
		base = 100
	}
}

#############################################
# Reject Inheritance						#
# by Ewan Cowhig Croft						#
#############################################

reject_inheritance_decision = {
	# Laamp picture.
	picture = {
		trigger = { is_landless_adventurer = yes }
		reference = "gfx/interface/illustrations/decisions/ep3_decision_laamp_negative.dds"
	}
	# Everyone else's picture.
	picture = {
		trigger = { is_landless_adventurer = no }
		reference = "gfx/interface/illustrations/decisions/decision_family_tree.dds"
	}
	desc = reject_inheritance_decision_desc
	selection_tooltip = reject_inheritance_decision_tooltip
	decision_group_type = adventurer_minor

	is_shown = {
		# Only characters that don't want to obtain more titles.
		can_access_reject_inheritance_decision_trigger = yes
		# Standard filter checks.
		is_playable_character = yes
		exists = dynasty
		# And naturally, you can't do this if you've already got the trait.
		NOT = { has_trait = gallivanter }
	}

	is_valid = {
		# General access.
		## This is in twice (three times, even) so that we can show you _why_ you have access to this decision.
		can_access_reject_inheritance_decision_trigger = yes
		# Plus, you can't waffle on this. You get one wild phase per character.
		NOT = { has_character_flag = has_embraced_responsibilities }
		# Must be an heir to something, else this is just free stress loss.
		trigger_if = {
			limit = { is_landed = yes }
			custom_tooltip = {
				text = reject_inheritance_decision.tt.is_heir_to_higher_tier_title
				any_heir_title = {
					count >= 1
					tier >= root.highest_held_title_tier
				}
			}
		}
	}

	is_valid_showing_failures_only = { is_available_healthy_adult = yes }

	effect = {
		# Sort trait shenanigans.
		## Fake-gain the trait — we do this up here so that it's at the top, but also so that the trait being added doesn't affect the stress block below..
		show_as_tooltip = { add_trait = gallivanter }
		## Next, we just _nuke_ your stress for this one.
		stress_impact = {
			base = -200
			arrogant = 100
			ambitious = 100
			diligent = 25
		}
		## Finally, actually add the trait.
		hidden_effect = {
			add_trait = gallivanter
			# And flag how long you've had it for for removal purposes.
			add_character_flag = {
				flag = recently_added_gallivanter
				years = 20
			}
		}
		# Opinion loss.
		## Lose a bunch of opinion with your family, who are not amused.
		every_close_or_extended_family_member = {
			limit = { would_judge_new_gallivanters_trigger = yes }
			custom = custom.every_judgemental_close_or_extended_family_member
			add_opinion = {
				target = root
				modifier = insulted_family_opinion
				opinion = -30
			}
		}
		## And your spouse(s), assuming they either have kids with you or were expecting to.
		every_spouse = {
			limit = {
				would_judge_new_gallivanters_trigger = yes
				OR = {
					# They have children with you.
					any_child = {
						count >= 1
						NOT = { has_trait = disinherited }
						any_parent = { this = root }
					}
					# Or thought they might.
					AND = {
						# Which means you're compatible for childbirth.
						OR = {
							AND = {
								is_female = yes
								age < define:NChildbirth|MAX_FEMALE_REPRODUCTION_AGE
								root = { is_male = yes }
							}
							AND = {
								is_male = yes
								root = {
									is_female = yes
									age < define:NChildbirth|MAX_FEMALE_REPRODUCTION_AGE
								}
							}
						}
						can_have_children = yes
						root = { can_have_children = yes }
					}
				}
			}
			add_opinion = {
				target = root
				modifier = insulted_family_opinion
				opinion = -30
			}
		}
		# Plus make sure we flag this to players.
		hidden_effect = {
			every_player = {
				limit = {
					any_heir = { this = root }
				}
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = disinherit_interaction_notification
					left_icon = root

					root = {
						show_as_tooltip = {
							custom_tooltip = reject_inheritance_decision.tt.heir_rejects_inheritance
							add_trait_force_tooltip = gallivanter
						}
					}
				}
			}
		}
		# Let newbs know that this doesn't rule them out of _all_ land.
		custom_tooltip = reject_inheritance_decision.tt.newb_explainer
	}

	cost = { prestige = 100 }

	ai_potential = {
		government_has_flag = government_is_landless_adventurer
		NOR = {
			has_realm_law = camp_purpose_legitimists
			has_trait = arrogant
			has_trait = ambitious
		}
		can_access_reject_inheritance_decision_trigger = yes
		any_heir_title = { count >= 1 }
	}

	ai_check_interval = 36

	ai_will_do = {
		# Start the base low so that you need a fair amount of positive reasons to take it.
		base = -70

		# Boost up for various traits.
		## +++ Content.
		modifier = {
			add = @laamp_gallivanter_ai_will_do_bonus_3_value
			has_trait = content
		}
		## +++ Eccentric.
		modifier = {
			add = @laamp_gallivanter_ai_will_do_bonus_3_value
			has_trait = eccentric
		}
		## ++ Lazy.
		modifier = {
			add = @laamp_gallivanter_ai_will_do_bonus_2_value
			has_trait = lazy
		}
		## ++ Fickle.
		modifier = {
			add = @laamp_gallivanter_ai_will_do_bonus_2_value
			has_trait = fickle
		}
		## ++ Humble.
		modifier = {
			add = @laamp_gallivanter_ai_will_do_bonus_2_value
			has_trait = humble
		}
		## + Arbitrary.
		modifier = {
			add = @laamp_gallivanter_ai_will_do_bonus_1_value
			has_trait = arbitrary
		}
		## + Craven.
		modifier = {
			add = @laamp_gallivanter_ai_will_do_bonus_1_value
			has_trait = craven
		}
		# Hurt somewhat by others.
		## -- Greedy.
		modifier = {
			add = @laamp_gallivanter_ai_will_do_malus_2_value
			has_trait = greedy
		}
		## --- Diligent.
		modifier = {
			add = @laamp_gallivanter_ai_will_do_malus_3_value
			has_trait = diligent
		}
		# Plus stress.
		## Level 1.
		modifier = {
			add = 25
			stress_level = 1
		}
		## Level 2.
		modifier = {
			add = 50
			stress_level = 2
		}
		## Level 3.
		modifier = {
			add = 75
			stress_level >= 3
		}
	}
}

#############################################
# Renounce Vows								#
#############################################

renounce_vows_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/ep3_decision_laamp_neutral_mountain.dds"
	}
	desc = renounce_vows_decision_desc
	selection_tooltip = renounce_vows_decision_tooltip
	decision_group_type = adventurer_minor

	is_shown = {
		is_landless_adventurer = yes
		has_trait = devoted
	}

	is_valid = {
		has_trait = devoted
	}

	effect = {
		stress_impact = {
			zealous = medium_stress_impact_gain
			humble = medium_stress_impact_gain
			cynical = medium_stress_impact_loss
			arrogant = medium_stress_impact_loss
		}
		remove_trait = devoted
		add_piety_level = -3
	}

	ai_potential = {
		has_trait = devoted
	}

	ai_check_interval = 64

	ai_will_do = {
		base = 0
		
		modifier = {
			add = 100
			NOT = {
				any_child = {
					count >= 2
					is_physically_able = yes
				}
			}
			NOT = { has_character_flag = ai_will_not_convert }
		}
	}
}

embrace_responsibilities_decision = {
	# Everyone else's picture.
	picture = { reference = "gfx/interface/illustrations/decisions/decision_dynasty_house.dds" }
	desc = embrace_responsibilities_decision_desc
	selection_tooltip = embrace_responsibilities_decision_tooltip
	decision_group_type = adventurer_minor

	is_shown = {
		# Remove the trait from yourself.
		has_trait = gallivanter
		# Standard filter checks.
		is_playable_character = yes
		exists = dynasty
	}

	is_valid = {
		# We show the trait again so that we're explicit about what this means.
		has_trait = gallivanter
		NOR = {
			# Can't access if you've accessed recently.
			custom_tooltip = {
				text = embrace_responsibilities_decision.tt.recently_added_gallivanter
				has_character_flag = recently_added_gallivanter
			}
			# And, if you accessed gallivanter again via content somehow, then you can't remove it _again_.
			custom_tooltip = {
				text = embrace_responsibilities_decision.tt.has_embraced_responsibilities
				has_character_flag = has_embraced_responsibilities
			}
		}
	}

	is_valid_showing_failures_only = { is_available_healthy_adult = yes }

	effect = {
		# Sort trait shenanigans.
		## Fake-lose the trait — we do this up here so that it's at the top, but also so that the trait being removed doesn't affect the stress block below..
		show_as_tooltip = { remove_trait = gallivanter }
		## Next, stress is quite high from this, unless you're keen for the resumption of responsibilities.
		stress_impact = {
			base = 100
			diligent = -10
			arrogant = -50
			ambitious = -80
		}
		## Plus make sure we flag this to players.
		hidden_effect = {
			every_player = {
				limit = {
					OR = {
						# Normal inheritance.
						any_close_or_extended_family_member = { this = root }
						# House inheritance.
						AND = {
							has_realm_law = single_heir_dynasty_house
							house = root.house
						}
					}
				}
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = restore_inheritance_interaction_notification
					left_icon = root

					root = {
						show_as_tooltip = {
							custom_tooltip = embrace_responsibilities_decision.tt.possible_heir_embraces_inheritance
							remove_trait = gallivanter
						}
					}
				}
			}
		}
		## Finally, actually toss the trait.
		hidden_effect = {
			remove_trait = gallivanter
			# And flag how long you've had it for for removal purposes.
			add_character_flag = {
				flag = has_embraced_responsibilities
				years = 10
			}
		}
		# Does anyone in our dynasty even have titles for us to care?
		if = {
			limit = {
				dynasty = {
					any_dynasty_member = {
						is_ruler = yes
						OR = {
							# Holds an elective title, which will generally make families candidates.
							any_held_title = {
								# Pre-filter out to higher tiers.
								tier >= tier_kingdom
								# Aaand then check if they're actually elective.
								has_title_law_flag = elective_succession_law
							}
							# Holds house seniority, in which case if we're the same house...
							AND = {
								has_realm_law = single_heir_dynasty_house
								house = root.house
							}
							# Is an ancestor, which we spoof a smidge.
							OR = {
								is_parent_of = root
								is_grandparent_of = root
								is_great_grandparent_of = root
							}
						}
					}
				}
			}
			# Reinheritance can take a bit, unlike disinheritance, so we tell the player not to worry.
			custom_tooltip = embrace_responsibilities_decision.tt.effects_delayed
			# Opinion loss.
			## Lose a bunch of opinion with your family, who don't appreciate the upset.
			### It'd be very annoying to try to set this up to _only_ grab the family who are below you in succession for each type of succession, largely because succession won't update immediately on removal of the trait, so we just assume you piss off everyone a little.
			every_close_or_extended_family_member = {
				limit = {
					# Excepting direct descendants or partners.
					NOR = {
						any_ancestor = { this = root }
						is_consort_of = root
					}
				}
				custom = custom.every_close_or_extended_family_member
				add_opinion = {
					target = root
					modifier = barging_into_succession_opinion
					opinion = -20
				}
			}
		}
	}

	cost = { prestige = 400 }
	ai_check_interval = 0
}

#############################################
# Reject Election							#
# by Ewan Cowhig Croft						#
#############################################

change_election_candidacy_status_decision = {
	# Everyone else's picture.
	picture = { reference = "gfx/interface/illustrations/decisions/decision_found_kingdom.dds" }
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { has_variable = rejects_electioneering }
				desc = change_election_candidacy_status_decision_desc.embrace
			}
			desc = change_election_candidacy_status_decision_desc.reject
		}
	}
	selection_tooltip = change_election_candidacy_status_decision_tooltip

	is_shown = {
		is_ai = no
		liege = {
			any_held_title = {
				tier >= tier_kingdom
				has_title_law_flag = elective_succession_law
			}
		}
	}

	is_valid = {
		custom_tooltip = {
			text = change_election_candidacy_status_decision.tt.you_are_an_election_candidate
			liege = {
				any_held_title = {
					tier >= tier_kingdom
					has_title_law_flag = elective_succession_law
					any_election_candidate = { this = root }
				}
			}
		}
	}

	cooldown = { years = 20 }

	effect = {
		# If we already do not want to be a candidate, then step up.
		if = {
			limit = { has_variable = rejects_electioneering }
			remove_variable = rejects_electioneering
			custom_tooltip = change_election_candidacy_status_decision.tt.embraces_candidacy
			liege = {
				add_opinion = {
					target = root
					modifier = indecision_opinion
					opinion = -25
				}
				every_vassal = {
					custom = custom.every_co_vassal_not_arrogant_or_ambitious
					limit = {
						NOR = {
							has_trait = arrogant
							has_trait = ambitious
						}
					}
					add_opinion = {
						target = root
						modifier = indecision_opinion
						opinion = -25
					}
				}
			}
		}
		# Otherwise, we are a candidate that wants not to be, so step down.
		else = {
			set_variable = {
				name = rejects_electioneering
				value = yes
			}
			custom_tooltip = change_election_candidacy_status_decision.tt.renounces_candidacy
			liege = {
				add_opinion = {
					target = root
					modifier = respect_opinion
					opinion = -25
				}
				every_vassal = {
					custom = custom.every_co_vassal_not_humble_or_content
					limit = {
						NOR = {
							has_trait = humble
							has_trait = content
						}
					}
					add_opinion = {
						target = root
						modifier = respect_opinion
						opinion = -25
					}
				}
			}
		}
	}

	cost = { prestige = 250 }
	ai_check_interval = 0
}

#############################################
# Bandit King
#############################################

bandit_king_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_levy_outcasts.dds" }
	desc = bandit_king_decision_desc
	decision_group_type = adventurer
	selection_tooltip = bandit_king_decision_tooltip
	sort_order = 150

	is_shown = {
		has_ep3_dlc_trigger = yes
		government_has_flag = government_is_landless_adventurer
		NOT = { has_character_flag = bandit_king_var }
	}

	is_valid = {
		calc_true_if = {
			amount >= 3
			has_trait = ambitious
			has_trait = schemer
			has_trait_xp = {
				trait = gallowsbait
				track = bandit
				value >= 40
			}
			has_trait_xp = {
				trait = gallowsbait
				track = thief
				value >= 40
			}
			has_trait_xp = {
				trait = gallowsbait
				track = poacher
				value >= 40
			}
			has_trait_xp = {
				trait = gallowsbait
				track = marauder
				value >= 40
			}
			has_trait_xp = {
				trait = gallowsbait
				track = trickster
				value >= 40
			}
		}
	}

	effect = {
		add_character_flag = bandit_king_var
		show_as_tooltip = { become_bandit_king_decision_effect = yes }
		custom_tooltip = bandit_king_decision_reward
		trigger_event = ep3_laamp_decision_event.1120
	}

	cost = {
		gold = 500
		prestige = 2000
	}
	
	ai_check_interval = 32
	
	ai_potential = {
		government_has_flag = government_is_landless_adventurer
	}
	
	ai_will_do = {
		base = 100
	}
}

#############################################
# Gather Provisions
# by Joe Parkin
#############################################

gather_provisions_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/ep3_decision_laamp_neutral_mountain.dds" }
	desc = gather_provisions_decision_desc
	selection_tooltip = gather_provisions_decision_tooltip
	ai_check_interval = 36
	sort_order = 200
	cooldown = { years = 3 }
	decision_group_type = adventurer_minor

	is_shown = {
		#DLC check.
		has_ep3_dlc_trigger = yes
		is_landless_adventurer = yes
	}

	is_valid_showing_failures_only = {
		is_available_allow_travelling = yes
	}

	effect = {
		custom_tooltip = {
			text = gather_provisions_decision_effect_tt
			trigger_event = ep3_decisions_event.7000
		}
		close_view = {
			view = decisions
			player = root
		}
	}

	ai_potential = {
		government_has_flag = government_is_landless_adventurer
		domicile ?= { provisions < max_provisions }
	}

	ai_will_do = {
		base = 100
	}
}

#############################################
# The Travels of CHAR.Root
# by Krzysztof Lankowski
#############################################

seasoned_visitor_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/fp3/fp3_decision_foundation.dds"
	}
	sort_order = 200
	decision_group_type = adventurer
	desc = seasoned_visitor_decision_desc
	selection_tooltip = seasoned_visitor_decision_tooltip

	is_shown = {
		has_ep3_dlc_trigger = yes
		government_has_flag = government_is_landless_adventurer
		NOT = {
			has_character_flag = had_seasoned_visitor_decision
		}
	}

	is_valid = {
		custom_tooltip = {
			text = seasoned_visitor_decision_not_enough_poi
			has_variable = poi_visited
			var:poi_visited >= 26 #1066 all poi in India. If you change the value here, please also change the value in loc string above
		}
		calc_true_if = {
			amount >= 2
			custom_tooltip = {
				text = seasoned_visitor_decision_not_enough_poi_advanced
				has_variable = poi_visited
				var:poi_visited >= 42 #1066 all poi in two Indias. If you change the value here, please also change the value in loc string above
			}
			prestige_level >= 4
			has_trait_xp = {
				trait = lifestyle_traveler
				track = travel
				value >= 60
			}
		}
	}

	is_valid_showing_failures_only = {
		NOT = {
			has_trait = incapable
		}
	}

	cost = {
		prestige = 1500
		gold = 500
	}

	effect = {
		custom_tooltip = {
			text = seasoned_visitor_decision_reward_desc
		}
		hidden_effect = {
			trigger_event = ep3_laamp_decision_event.1100
		}
	}

	ai_check_interval = 32
	
	ai_potential = {
		government_has_flag = government_is_landless_adventurer
	}
	
	ai_will_do = {
		base = 100
	}
}

#############################################
# A Catholic Path
# by Krzysztof Lankowski
#############################################

zealous_missionary_prep_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_personal_religious.dds"
	}
	sort_order = 200
	decision_group_type = adventurer
	desc = zealous_missionary_prep_decision_desc
	selection_tooltip = zealous_missionary_prep_decision_tooltip

	is_shown = {
		has_ep3_dlc_trigger = yes
		government_has_flag = government_is_landless_adventurer
		is_adult = yes
		NOR = {
			has_trait = cynical
			has_character_flag = zealous_missionary_prep
		}
	}

	is_valid = {
		calc_true_if = {
			amount >= 2
			custom_tooltip = {
				text = zealous_missionary_prep_decision_holy_sites_visited_req
				has_variable = visited_unique_holy_sites_count
				OR = {
					var:visited_unique_holy_sites_count >= 2
					is_ai = yes
				}
				
			}
			has_trait = theologian
			piety_level >= 4
		}
		

		custom_tooltip = {
			text = zealous_missionary_prep_decision_holy_site
			OR = {
				AND = {
					is_ai = no
					location = {
						barony = {
							is_holy_site_of = root.faith
						}
						county.faith = root.faith
						county.holder.top_liege.faith = root.faith
					}
				}
				AND = {
					is_ai = yes
					has_trait = zealous
					learning > 18
					NOT = {
						any_player = {
							faith = location.faith
						}
					}
					current_month = 4 # 12 times less ai missionaries getting spawned 
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		NOT = {
			has_trait = incapable
		}
	}

	cost = {
		piety = 2500
	}

	effect = {
		if = {
			limit = {
				NOT = {
					has_trait = zealous
				}
			}
			add_trait = zealous
			add_stress = medium_stress_gain
		}
		hidden_effect = {
			trigger_event = ep3_laamp_decision_event.1101
			add_character_flag = zealous_missionary_prep
		}
		custom_tooltip = {
			text = zealous_missionary_prep_decision_reward_desc
		}
		if = {
			limit = {
				any_owned_story = {
					story_type = story_hasan
				}
			}
			custom_tooltip = chance_to_advance_to_the_assassins_tt
		}
	}
	
	ai_check_interval = 32
	
	ai_potential = {
		ai_zeal >= 50
		government_has_flag = government_is_landless_adventurer
	}
	
	ai_will_do = {
		base = 100
	}
}

zealous_missionary_start_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_personal_religious.dds"
	}
	sort_order = 400
	decision_group_type = adventurer
	desc = zealous_missionary_prep_decision_desc
	selection_tooltip = zealous_missionary_prep_decision_tooltip

	is_shown = {
		has_ep3_dlc_trigger = yes
		government_has_flag = government_is_landless_adventurer
		has_character_flag = zealous_missionary_prep
		NOR = {
			has_character_flag = zealous_missionary_start
			is_ai = yes
			any_player = {
				OR = {
					this = location.county.holder
					this = location.county.holder.top_liege
				}
			}
		}
	}

	is_valid = {
		location.county = { hasan_evangelize_province_trigger = yes }
	}

	is_valid_showing_failures_only = {
		NOT = {
			has_trait = incapable
		}
	}

	effect = {
		custom_tooltip = {
			text = zealous_missionary_start_decision_reward_desc
		}
		show_as_tooltip = {
			ep3_hasan_advance_radicalism = yes
		}
		hidden_effect = {
			trigger_event = ep3_laamp_decision_event.1102
		}
	}
	
	ai_check_interval = 32
	
	ai_potential = {
		ai_zeal >= 50
		has_character_flag = zealous_missionary_prep
		government_has_flag = government_is_landless_adventurer
	}
	
	ai_will_do = {
		base = 100
	}
}

#############################################
# Become Conqueror
# by Krzysztof Lankowski
#############################################

become_conqueror_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/fp2_decision_struggle_hostility.dds"
	}
	sort_order = 400
	decision_group_type = adventurer
	desc = become_conqueror_decision_desc
	selection_tooltip = become_conqueror_decision_tooltip

	is_shown = {
		has_ep3_dlc_trigger = yes
		government_has_flag = government_is_landless_adventurer
		NOR = {
			has_game_rule = no_conquerors_frequency
			has_character_flag = had_laamp_conq_decision
			has_trait = conqueror
		}
		trigger_if = {
			limit = {
				is_ai = yes
				OR = {
					exists = location.county.holder
					exists = location.duchy.holder
					exists = location.county.holder.top_liege
				}
			}
			NOT = {
				any_player = {
					OR = {
						this = location.county.holder
						this = location.duchy.holder
						this = location.county.holder.top_liege
					}
				}
			}
		}
	}

	is_valid = {
		calc_true_if = {
			amount >= 8
			martial >= 22
			prestige_level >= 5
			AND = {
				has_trait = strategist
				has_trait = gallant
			}
			custom_tooltip = {
				text = become_conqueror_decision_war_participation
				any_memory = {
					count >= 20
					OR = {
						has_memory_type = offensive_war
						has_memory_type = defensive_war
						has_memory_type = joined_allys_war
					}
				}
			}
			custom_tooltip = {
				text = become_conqueror_decision_war_participation_kingdom
				any_memory = {
					count >= 5
					OR = {
						has_memory_type = offensive_war
						has_memory_type = defensive_war
						has_memory_type = joined_allys_war
					}
					any_memory_participant = {
						primary_title.tier >= tier_kingdom
					}
				}
			}
			calc_true_if = {
				amount >= 1
				custom_tooltip = {
					text = become_conqueror_decision_two_commander_traits
					any_character_trait = {
						count >= 2
						has_trait_category = commander
					}
				}
				martial >= 28
			}
			
			custom_tooltip = {
				text = become_conqueror_decision_enough_troops
				current_military_strength >= 4000
			}
			custom_tooltip = {
				text = become_conqueror_decision_enough_battle_kills
				any_killed_character = {
					count >= 12
				}
			}
			custom_tooltip = {
				text = become_conqueror_decision_enough_war_contracts
				has_variable = war_contract_tracker
				var:war_contract_tracker >= 20
			}
			calc_true_if = {
				amount >= 1
				custom_tooltip = {
					text = become_conqueror_decision_enough_high_level_knights
					any_knight = {
						count >= 6
						prowess >= 18
					}
				}
				custom_tooltip = {
					text = become_conqueror_decision_enough_mediocre_knights
					any_knight = {
						count >= 12
						prowess >= 12
					}
				}
			}
			
		}
	}

	is_valid_showing_failures_only = {
		NOT = {
			has_trait = incapable
		}
	}

	cost = {
		prestige = 5000
	}

	effect = {
		custom_tooltip = become_conqueror_decision_reward
		custom_tooltip = become_conqueror_decision_troops
		if = {
			limit = { has_dlc_feature = legends }
			custom_tooltip = become_conqueror_decision_legend_seed
		}
		trigger_event = ep3_laamp_decision_event.1110
		show_as_tooltip = {
			if = {
				limit = {
					exists = location.kingdom.holder
				}
				add_pressed_claim = location.kingdom
				start_war = {
					cb = ep3_laamp_adventurer_kingdom_invasion
					target = location.kingdom.holder
					claimant = root
					target_title = location.kingdom
					target_title = location.kingdom.title_capital_county
				}
			}
			else_if = {
				limit = {
					exists = location.duchy.holder
				}
				add_pressed_claim = location.duchy
				start_war = {
					cb = claim_cb
					target = location.duchy.holder
					claimant = root
					target_title = location.duchy
					target_title = location.duchy.title_capital_county
				}
			}
			else_if = {
				limit = {
					exists = location.county.holder
				}
				add_pressed_claim = location.county
				start_war = {
					cb = claim_cb
					target = location.county.holder
					claimant = root
					target_title = location.county
				}
			}
		}
		
	}
	ai_check_interval = 0
}

#############################################
# Found a City
# by Krzysztof Lankowski
#############################################

start_city_construction_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/ep3_decision_city.dds"
	}
	sort_order = 200
	decision_group_type = adventurer
	desc = start_city_construction_decision_desc
	selection_tooltip = start_city_construction_decision_tooltip

	is_shown = {
		has_ep3_dlc_trigger = yes
		government_has_flag = government_is_landless_adventurer
		NOT = {
			has_character_flag = laamp_city_builder
		}
	}

	is_valid = {
		custom_tooltip = {
			text = start_city_construction_decision_empty_holding
			exists = location.county.holder
			location = {
				has_holding = no
			}
		} 
		culture = {
			has_innovation = innovation_city_planning
		}
		location.county.holder ?= {
			opinion = {
				target = root
				value >= 10
			}
		}
		calc_true_if = {
			amount >= 3
			gold >= 1000
			piety_level >= 3
			prestige_level >= 3
			has_trait = architect
			stewardship >= 18
		}
	}

	is_valid_showing_failures_only = {
		NOT = {
			has_trait = incapable
		}
	}

	cost = {
		gold = 400
	}

	effect = {
		show_as_tooltip = {
			location = {
				begin_create_holding = {
					type = castle_holding
				}
			}
		}
		custom_tooltip = start_city_construction_decision_more_rewards
		trigger_event = ep3_laamp_decision_event.1130
	}
	
	ai_check_interval = 32
	
	ai_potential = {
		government_has_flag = government_is_landless_adventurer
	}
	
	ai_will_do = {
		base = 100
	}
}

#############################################
# Become a Knight Errant
#############################################

knight_errant_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_tale.dds" }
	desc = knight_errant_decision_desc
	decision_group_type = adventurer
	selection_tooltip = knight_errant_decision_tooltip
	sort_order = 300

	is_shown = {
		has_ep3_dlc_trigger = yes
		is_landless_adventurer = yes
		NOT = { has_trait = knight_errant }
		NOT = { has_variable = knight_errant_decision_var }
	}
	
	is_valid = {
		prestige_level >= 4
		custom_tooltip = {
			text = camp_purpose_mercenaries_tt
			has_realm_law = camp_purpose_mercenaries
		}
		NOT = { has_trait = gallowsbait }
		trigger_if = {
			limit = {
				has_variable = justicar_contracts_succeeded_counter
			}
			save_temporary_scope_value_as = {
				name = contract_tally
				value = var:justicar_contracts_succeeded_counter
			}
		}
		trigger_else = {
			save_temporary_scope_value_as = {
				name = contract_tally
				value = 0
			}				
		}
		custom_tooltip = {
			text = knight_errant_decision_tt
			has_variable = justicar_contracts_succeeded_counter
			var:justicar_contracts_succeeded_counter >= 10
		}
	}

	is_valid_showing_failures_only = {
		NOR = {
			is_available = no
			has_trait = infirm
			is_incapable = yes
		}
	}
	
	cost = {
		prestige = 2000
	}

	effect = {
		set_variable = knight_errant_decision_var
		show_as_tooltip = {
			disburse_knight_errant_decision_rewards_effect = yes
		}
		trigger_event = ep3_decisions_event.5001
	}
	
	ai_check_interval = 32
	
	ai_potential = {
		ai_honor >= 25
		government_has_flag = government_is_landless_adventurer
		prestige > 500
		NOT = { has_trait = arrogant }
	}
	
	ai_will_do = {
		base = 50
		modifier = {
			add = -30
			has_trait = humble
		}
	}
}

#############################################
# Butcher Animals							#
# by Ewan Cowhig Croft						#
#############################################

butcher_animals_decision = {
	title = butcher_animals_decision_name
	picture = { reference = "gfx/interface/illustrations/decisions/decision_pet_dog.dds" }
	desc = butcher_animals_decision_desc
	selection_tooltip = butcher_animals_decision_tooltip
	decision_group_type = adventurer

	sort_order = 80

	is_shown = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard filters.
		is_landless_adventurer = yes
		# Flavour checks.
		## We deliberately don't show you this most of the time — it should be hidden unless things are absolutely dire.
		domicile.provisions <= 500
	}

	is_valid = {
		OR = {
			# Dogs.
			butcher_animals_decision_available_dogs_trigger = yes
			# Cats.
			butcher_animals_decision_available_cats_trigger = yes
			# Horses.
			butcher_animals_decision_available_horses_trigger = yes
			# Elephants.
			butcher_animals_decision_available_elephants_trigger = yes
		}
	}

	is_valid_showing_failures_only = {
		# Standard checks.
		is_available_allow_travelling = yes
		# Shouldn't be at war.
		is_at_war = no
	}

	widget = {
		gui = "decision_view_widget_option_list_generic"
		controller = decision_option_list_controller
		decision_to_second_step_button = "BUTCHER_ANIMALS_DECISION_NEXT_STEP_BUTTON"
		item = {
			value = butcher_dogs
			is_valid = {
				custom_tooltip = {
					text = butcher_animals_decision.tt.you_have_no_dogs
					butcher_animals_decision_available_dogs_trigger = yes
				}
			}
			localization = butcher_animals_decision_option_dogs
			icon = "gfx/interface/icons/pets/artifact_dog_folded_ears_fox_colored.dds"
		}
		item = {
			value = butcher_cats
			is_valid = {
				custom_tooltip = {
					text = butcher_animals_decision.tt.you_have_no_cats
					butcher_animals_decision_available_cats_trigger = yes
				}
			}
			localization = butcher_animals_decision_option_cats
			icon = "gfx/interface/icons/pets/artifact_cat_tabby.dds"
		}
		item = {
			value = butcher_horses
			is_valid = {
				custom_tooltip = {
					text = butcher_animals_decision.tt.you_have_no_horses
					butcher_animals_decision_available_horses_trigger = yes
				}
			}
			localization = butcher_animals_decision_option_horses
			icon = "gfx/interface/icons/regimenttypes/konni.dds"
		}
		item = {
			value = butcher_elephants
			is_valid = {
				custom_tooltip = {
					text = butcher_animals_decision.tt.you_have_no_elephants
					butcher_animals_decision_available_elephants_trigger = yes
				}
			}
			localization = butcher_animals_decision_option_elephants
			icon = "gfx/interface/icons/regimenttypes/war_elephants.dds"
		}
	}

	cost = { prestige = medium_prestige_value }

	effect = {
		show_as_tooltip = {
			random_list = {
				100 = {
					show_chance = no
					desc = butcher_animals_decision.tt.dogs
					custom_tooltip = butcher_animals_decision.tt.provisions_gain.per_dog_mod
					custom_tooltip = butcher_animals_decision.tt.provisions_gain.building.dog
					custom_tooltip = butcher_animals_decision.tt.cooldown.dogs
				}
				100 = {
					show_chance = no
					desc = butcher_animals_decision.tt.cats
					custom_tooltip = butcher_animals_decision.tt.provisions_gain.per_cat_mod
					custom_tooltip = butcher_animals_decision.tt.cooldown.cats
				}
				100 = {
					show_chance = no
					desc = butcher_animals_decision.tt.horses
					# War horse is niche content, so we don't show it unless it applies.
					if = {
						limit = { has_character_modifier = horse_story_modifier }
						custom_tooltip = butcher_animals_decision.tt.provisions_gain.your_horse_mod
					}
					custom_tooltip = butcher_animals_decision.tt.provisions_gain.building.horse
					custom_tooltip = butcher_animals_decision.tt.cooldown.horses
				}
				100 = {
					show_chance = no
					desc = butcher_animals_decision.tt.elephants
					custom_tooltip = butcher_animals_decision.tt.provisions_gain.building.elephant
					custom_tooltip = butcher_animals_decision.tt.cooldown.elephants
				}
			}
		}
		switch = {
			trigger = yes
			scope:butcher_dogs = { trigger_event = ep3_laamp_decision_event.1201 }
			scope:butcher_cats = { trigger_event = ep3_laamp_decision_event.1202 }
			scope:butcher_horses = { trigger_event = ep3_laamp_decision_event.1203 }
			scope:butcher_elephants = { trigger_event = ep3_laamp_decision_event.1204 }
		}
	}
	ai_check_interval = 0
}

#############################################
# Humiliate the Stooge
#############################################

humiliate_the_stooge_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_prison.dds" }
	desc = humiliate_the_stooge_decision_desc
	selection_tooltip = humiliate_the_stooge_decision_tooltip
	ai_check_interval = 24
	sort_order = 150
	decision_group_type = adventurer_minor
	
	cooldown = { years = 2 }
	
	ai_potential = {
		stress > 0
	}

	is_shown = {
		has_ep3_dlc_trigger = yes
		is_landless_adventurer = yes
	}
	
	is_valid = {
		employs_court_position = stooge_camp_officer
	}

	is_valid_showing_failures_only = {
		NOR = {
			is_available = no
			has_trait = infirm
			is_incapable = yes
		}
	}
	
	cost = {
		prestige = 20
	}

	effect = {
		custom_tooltip = humiliate_the_stooge_decision_rewards
		random_courtier = {
			limit = { has_court_position = stooge_camp_officer }
			save_scope_as = stooge
		}
		scope:stooge ?= {
			humiliate_stooge_counter_effect = yes
		}
		humiliate_stooge_reward_effect = yes
		close_view = {
			view = decisions
			player = root
		}
	}

	ai_will_do = {
		base = 50
		modifier = {
			add = -50
			has_trait = compassionate
		}
		modifier = {
			add = 50
			OR = {
				has_trait = callous
				has_trait = sadistic
			}
		}
		modifier = {
			add = -50
			prestige <= 50
		}
	}
}
